home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
FCOPY31.ARJ
/
README
< prev
next >
Wrap
Text File
|
1992-05-12
|
3KB
|
88 lines
FCOPY - C function to perform file copies.
Version 2.1
This archive contains the following files:
readme (this file)
fcopy.c
fcopy.h
copyfile.asm
farread.asm
farwrite.asm
copytest.c
copytest.exe
fcopy is a C function that copies one file to another, much like
the DOS COPY command. It operates on single files only (i.e., does
not accept wildcards). To copy multiple files, fcopy must be used
in a loop with findfirst and findnext functions (Turbo C++ library
-- other compilers have similar names).
fcopy also does not check to see if the specified files are the
same, so it is up to the calling function to verify that the two
file specs do not, in fact, refer to the same file.
Version 2.1 contains the _copyfile code improvements of version 3.1
with the simplified version of fcopy 2.0.
Version 2.1 of fcopy calls the function _copyfile (written in
assembler) to perform the actual reads and writes. Source is
contained in the file COPYFILE.ASM.
Version 1.1 of fcopy used separate functions _farread and _farwrite
to perform the reads and writes to a far buffer. Since these two
can be used as general purpose functions, they have been added to
this archive.
The new version 2.1 (using _copyfile) has a slight size and speed
advantage over the earlier version, in that the far pointer to the
file buffer needs to be loaded only once for the entire copy
operation. The copy loop is completely contained within the single
assembler module.
Usage for the function in a C program is as follows:
#include "fcopy.h"
int fcopy (char *sourcename, char *targetname)
The function returns 0 on success, and -1 if an error occurred. On
failure, the global variables errno and _doserrno are set to one of
the following:
EINVFNC Invalid function number (1)
ENOFILE File not found (2)
ENOPATH Path not found (3)
EMFILE Too many open files (4)
EACCESS Permission denied (5)
EBADF Bad file number (6)
ECONTR Memory blocks destroyed (7)
ENOMEM Not enough core (8)
EINVMEM Invalid memory block address (9)
EINVACC Invalid access code (12)
-2 Target disk full (-2)
See the source code for more information.
A short demo program (COPYTEST.EXE) is included. It prompts the
user for source and target filenames and then performs the copy. If
an error occurred during the copy operation, an error message is
displayed. (This simple program does NOT test the source and
target filenames to detect whether they actually refer to the same
file.)
To compile the demo program using Turbo C++, use the following
command line (for the small memory model):
tcc -ms copytest fcopy copyfile.asm
Other memory models are supported; compile by defining the symbol
_model=[model], where model is small, compact, medium, large, or
huge. Example:
tcc -ml -Td_model=large copytest fcopy copyfile.asm
Ray Waters
CompuServe ID 72261,33
May 12, 1992